﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Dropbox;
using System.Threading.Tasks;
using System.Diagnostics;

namespace DropboxSample
{
    public partial class MainPage : PhoneApplicationPage
    {
        DropboxClient dropbox;
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            if (string.IsNullOrEmpty(AppKeys.kDropboxAppKey) || String.IsNullOrEmpty(AppKeys.kDropboxAppSecret))
                throw new NotImplementedException("You need to add your keys");
            dropbox = new DropboxClient(AppKeys.kDropboxAppKey, AppKeys.kDropboxAppSecret);
        }

        private void clickMeButton_Click(object sender, RoutedEventArgs e)
        {
            Auth();
        }

        private async Task Auth()
        {
            var result = await dropbox.Authorize("http://jaykimble.net");
            Debug.WriteLine("authd: " + result);
        }

    }
}